From 9962a15cbaf36b29c2a20a52faf731e913fe6715 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 13 Jun 2005 19:09:06 +0000 Subject: [PATCH] Try harder not to modify readonly strings. (#307541, Torsten Schoenfeld) 2005-06-13 Matthias Clasen * gtk/gtkaccellabel.c (_gtk_accel_label_class_get_accelerator_label): Try harder not to modify readonly strings. (#307541, Torsten Schoenfeld) --- ChangeLog | 3 +++ ChangeLog.pre-2-10 | 3 +++ ChangeLog.pre-2-8 | 3 +++ gtk/gtkaccellabel.c | 34 ++++++++++++++++++---------------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 658a87aa1c..1f1c306264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-06-13 Matthias Clasen + * gtk/gtkaccellabel.c (_gtk_accel_label_class_get_accelerator_label): + Try harder not to modify readonly strings. (#307541, Torsten Schoenfeld) + * gtk/gtkfilechooserbutton.c (model_update_current_folder): Free the data of the row before overwriting it. (#307490, Kjartan Maraas) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 658a87aa1c..1f1c306264 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2005-06-13 Matthias Clasen + * gtk/gtkaccellabel.c (_gtk_accel_label_class_get_accelerator_label): + Try harder not to modify readonly strings. (#307541, Torsten Schoenfeld) + * gtk/gtkfilechooserbutton.c (model_update_current_folder): Free the data of the row before overwriting it. (#307490, Kjartan Maraas) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 658a87aa1c..1f1c306264 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,8 @@ 2005-06-13 Matthias Clasen + * gtk/gtkaccellabel.c (_gtk_accel_label_class_get_accelerator_label): + Try harder not to modify readonly strings. (#307541, Torsten Schoenfeld) + * gtk/gtkfilechooserbutton.c (model_update_current_folder): Free the data of the row before overwriting it. (#307490, Kjartan Maraas) diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index cca5d342f9..cafd022018 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -590,25 +590,27 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass, gchar *tmp; tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key)); - if (tmp == NULL) - tmp = ""; - else if (tmp[0] != 0 && tmp[1] == 0) - tmp[0] = g_ascii_toupper (tmp[0]); - else + if (tmp != NULL) { - gchar msg[128]; - gchar *str; - - strcpy (msg, "keyboard label|"); - g_strlcat (msg, tmp, 128); - str = dgettext (GETTEXT_PACKAGE, msg); - if (str == msg) - substitute_underscores (tmp); + if (tmp[0] != 0 && tmp[1] == 0) + g_string_append_c (gstring, g_ascii_toupper (tmp[0])); else - tmp = str; + { + gchar msg[128]; + gchar *str; + + strcpy (msg, "keyboard label|"); + g_strlcat (msg, tmp, 128); + str = dgettext (GETTEXT_PACKAGE, msg); + if (str == msg) + { + g_string_append (gstring, tmp); + substitute_underscores (gstring->str); + } + else + g_string_append (gstring, str); + } } - - g_string_append (gstring, tmp); } return g_string_free (gstring, FALSE); -- 2.30.2